package com.atguigu.spzx.product.client;

import com.atguigu.spzx.model.entity.order.OrderItem;
import com.atguigu.spzx.model.entity.product.ProductSku;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.product.client.fallback.ProductClientFallback;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(value = "service-product",fallback = ProductClientFallback.class)
public interface ProductClient {
    @Operation(summary = "根据skuid查询sku数据")
    @GetMapping("/api/product/sku/{skuId}")
    public Result<ProductSku> findSkuBySkuId(@PathVariable("skuId")Long skuId);
    @Operation(summary = "查询订单详情对应的商品列表，同时验库存减库存")
    @GetMapping("/api/product/findProductSkus")
    public Result<List<ProductSku>> findProductSkus(@RequestBody List<OrderItem>
                                                                orderItemList);
}
